<?php

require_once( '../../conf/conf.inc' );
require_once( PATH_FRAME.'/etwork.php' );

$etw = new etwork;
$etw->parseURL('edit/yaku', 3);

$etw->limitLevel = access::MODERATOR;
$etw->isEdit = true;

if (! isset($etw->pathParameters[0]) ) {
    
    $etw->setTemplate('yaku', TRUE, TRUE, 0);
    
    $etw->setPankuzu(array(
        array('dir'=>'', 'config'=>'index'),
        array('dir'=>'edit', 'config'=>'modelate')
    ));
    $etw->setTitle(array('yaku','list'));

    $loader = new modelLoader;
    $loader->model = 'yaku';
    $loader->order = @$etw->EX_GET['r'] ? $etw->EX_GET['r'] : '_update_date';
    $loader->alike = @$etw->EX_GET['s'];
    $loader->offset = @$etw->EX_GET['p'];
    $loader->returning = 'list';
    $etw->addLoader($loader);

    $etw->loadData();

} else if (isNumber($etw->pathParameters[0])) {

    $etw->setTemplate( 'yaku', true, false );
    $etw->addClearTemplate( null, 'hito|solo'.$etw->pathParameters[0]);

    $etw->setPankuzu(array(
        array('dir'=>'', 'config'=>'index'),
        array('dir'=>'edit', 'config'=>'modelate'),
        array('dir'=>'edit/yaku', 'config'=>array('yaku','list'))
    ));
    if ($etw->pathParameters[0] > 0)
        $etw->setTitle(array('edit'),array('solo'=>'name'));
    else
        $etw->setTitle(array('yaku','newpost'));

    $etw->noCaching = true;

    $etw->jumpTo = URL_EDIT .'yaku';

    $loader = new modelLoader;
    $loader->model = 'yaku';
    $loader->solo = $etw->pathParameters[0];
    $loader->targetId = 'yaku_id';
    $loader->returning = 'solo';
    $loader->isEdit = TRUE;
    $etw->addLoader($loader);

    $etw->loadData();

}

$etw->showFinal();


